package com.dianping.cat.consumer.heartbeat.model.entity;

import com.dianping.cat.consumer.heartbeat.model.BaseEntity;
import com.dianping.cat.consumer.heartbeat.model.IVisitor;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;





public class HeartbeatReport
  extends BaseEntity<HeartbeatReport>
{
  private String m_domain;
  private Date m_startTime;
  private Date m_endTime;
/*  21 */   private Map<String, Machine> m_machines = new LinkedHashMap();

/*  23 */   private Set<String> m_domainNames = new LinkedHashSet();

  private Set<String> m_ips = new LinkedHashSet();





  public HeartbeatReport(String domain) { this.m_domain = domain; }




  public void accept(IVisitor visitor) { visitor.visitHeartbeatReport(this); }


  public HeartbeatReport addDomain(String domain) {
/*  40 */     this.m_domainNames.add(domain);
/*  41 */     return this;
  }

  public HeartbeatReport addIp(String ip) {
/*  45 */     this.m_ips.add(ip);
/*  46 */     return this;
  }

  public HeartbeatReport addMachine(Machine machine) {
/*  50 */     this.m_machines.put(machine.getIp(), machine);
/*  51 */     return this;
  }


  public boolean equals(Object obj) {
/*  56 */     if (obj instanceof HeartbeatReport) {
/*  57 */       HeartbeatReport _o = (HeartbeatReport)obj;

/*  59 */       if (!equals(getDomain(), _o.getDomain())) {
/*  60 */         return false;
      }

/*  63 */       return true;
    }

/*  66 */     return false;
  }


/*  70 */   public Machine findMachine(String ip) { return (Machine)this.m_machines.get(ip); }


  public Machine findOrCreateMachine(String ip) {
/*  74 */     Machine machine = (Machine)this.m_machines.get(ip);

/*  76 */     if (machine == null) {
/*  77 */       synchronized (this.m_machines) {
        machine = (Machine)this.m_machines.get(ip);

/*  80 */         if (machine == null) {
/*  81 */           machine = new Machine(ip);
/*  82 */           this.m_machines.put(ip, machine);
        }
      }
    }

/*  87 */     return machine;
  }


/*  91 */   public String getDomain() { return this.m_domain; }



/*  95 */   public Set<String> getDomainNames() { return this.m_domainNames; }



/*  99 */   public Date getEndTime() { return this.m_endTime; }



/* 103 */   public Set<String> getIps() { return this.m_ips; }



/* 107 */   public Map<String, Machine> getMachines() { return this.m_machines; }



/* 111 */   public Date getStartTime() { return this.m_startTime; }





  public void mergeAttributes(HeartbeatReport other) {
/* 125 */     assertAttributeEquals(other, "heartbeat-report", "domain", this.m_domain, other.getDomain());

/* 127 */     if (other.getStartTime() != null) {
/* 128 */       this.m_startTime = other.getStartTime();
    }

/* 131 */     if (other.getEndTime() != null) {
/* 132 */       this.m_endTime = other.getEndTime();
    }
  }


/* 137 */   public Machine removeMachine(String ip) { return (Machine)this.m_machines.remove(ip); }


  public HeartbeatReport setDomain(String domain) {
/* 141 */     this.m_domain = domain;
/* 142 */     return this;
  }

  public HeartbeatReport setEndTime(Date endTime) {
/* 146 */     this.m_endTime = endTime;
/* 147 */     return this;
  }

  public HeartbeatReport setStartTime(Date startTime) {
/* 151 */     this.m_startTime = startTime;
/* 152 */     return this;
  }

  public HeartbeatReport() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/heartbeat/model/entity/HeartbeatReport.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */